package com.tucc.hello.leetcode.no1_400.no1_200.no168;

/**
 * @author tucc
 * @description todo
 * @package com.tucc.hello.leetcode
 * @date 2021/5/20
 **/
public class Solution {

    public static void main(String[] args) {
        Solution solution = new Solution();
        for (int i = 1; i <= 1000; i++) {
            System.out.println(i + " : " + solution.convertToTitle(i));
        }
    }

    public String convertToTitle(int columnNumber) {
        StringBuilder stringBuilder = new StringBuilder();
        while (columnNumber > 0) {
            columnNumber--;
            stringBuilder.append((char) ('A' + columnNumber % 26));
            columnNumber /= 26;
        }
        return stringBuilder.reverse().toString();
    }
}
